figure.Molino = new Class({
    Extends: figure.DomFigure,

    initialize: function(id, css) {
        this.parent(id);
        this.createElement('canvas', {
            id: id,
            Width: 100,
            Height: 100,
            css: css
        });
        this.element = this.getElement();
        this.writeTag(css.top + 1.2 * figure.molinoSizes.HEIGHT, css.left - figure.molinoSizes.WIDTH / 2)
    },

    draw: function() {
        var ctx = this.element[0].getContext('2d');

        var x = 0;
        var y = 0;
        var height = figure.molinoSizes.HEIGHT;
        var width = figure.molinoSizes.WIDTH;
        ctx.beginPath();
        ctx.moveTo(x , y);
        ctx.lineTo(x + width, y);
        ctx.lineTo(x + width, y + height);
        ctx.lineTo(x, y + height);
        ctx.lineTo(x, y);
        ctx.fillStyle = this._createGradient(ctx);
        ctx.fill();
        ctx.stroke();
        ctx.beginPath();
        ctx.arc(width/2, height/2, width/2 - 2, 0, 2*Math.PI, true);
        ctx.stroke();
        ctx.beginPath();
        ctx.arc(width/2, height/2, width/2 - 4, 0, 2*Math.PI, true);
        ctx.stroke();
        ctx.stroke();
    },

    _createGradient: function(context) {
        var grd = context.createLinearGradient(10,2,30,10);
        grd.addColorStop(0,"white");
        grd.addColorStop(1, figure.molinoColor);
        return grd;
    }

});
